import React from 'react'
import { NavBar, Icon } from 'antd-mobile';
import './success.scss'
class Com extends React.Component {
  state = {
    address: '',
    time: ''
  }
  componentDidMount () {
    if (this.props.location.state) {
      console.log(111)
      const { address, time } = this.props.location.state
      this.setState({
        address,
        time
      })
      console.log(this.state.address)
      console.log(this.state.time)
      // sessionStorage.setItem("address",address)
      // sessionStorage.setItem("time",time)
      // console.log(sessionStorage.getItem('address'))
      // console.log(sessionStorage.getItem('time'))
    }
  }
  render () {
    return (
      <div className="signin_success_box">
        <div className="signin_success_header">
          <NavBar
            mode="light"
            icon={<Icon type="left"/>}
            onLeftClick={() => {this.props.history.goBack()}}
          >签到成功</NavBar>
          </div>
        <div className="signin_success_content content">
          <div className="success_bg">
            <img src="./images/application_ images/success_bg_03.png" alt=""/>
          </div>
          <div className="signin_info_box">
            <div className="signin_time">
              <p>签到时间</p>
              <img src="./images/application_ images/signin_time_03.png" alt=""/>
              <span>{ this.state.time }</span>
            </div>
            <div className="signin_address">
              <p>签到地点</p>
              <img src="./images/application_ images/address_03.png" alt=""/>
              <span>{ this.state.address }</span>
            </div>
            <button onClick={() => {
              this.props.history.push('/application/signin/history')
            }}>查看历史考勤记录</button>
          </div>
        </div>
      </div>
    )
  }
}
export default Com